#include <iostream>
#include <algorithm>
using namespace std;
const int N = 100010;
int a[N], idx[N], ans[N];
int n;
int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        idx[i] = i;
    }
    sort(idx, idx + n, [](const int &x, const int &y)
         { return a[x] < a[y]; });
    // for(int i = 0; i < n; ++i) cout << idx[i] << ' ';
    // cout << endl;
    // 拍在前面的不一定刷题比他多
    int num = -1;
    int xx = 0;
    for (int i = 0; i < n && num == -1;)
    {
        // 第一个满足左侧的人大于右侧的人的成绩就是要补题的数量
        int j = i++;
        while (i < n && a[idx[i]] == a[idx[i - 1]])
            ++i;
        // 找到第一个成绩比他大的人
        int l = j, r = n - i;
        if (l < r)
            continue;
        else
        {
            // cout << l << ' ' << r << endl;
            xx = idx[j];
            if (l > r)
                num = a[idx[j]];
            else if (l == r)
                num = a[idx[j]] + 1;
        }
    }
    // cout << num << endl;
    for (int i = 0; a[idx[i]] < a[xx]; ++i)
        ans[idx[i]] = num - a[idx[i]];

    for (int i = 0; i < n; ++i)
        cout << ans[i] << ' ';
    cout << endl;
    return 0;
}